package com.dragon.modules.yuegou.enums.code;

import com.dragon.common.constant.enums.IBusinessCode;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 会员业务状态码
 * 
 * @author 刘武
 *
 */
public enum FriendCode implements IBusinessCode {

	/**
	 * 请勿重复点赞
	 */
	REPEAT_LIKE(26001, "请勿重复点赞"),

	/**
	 * 状态码说明
	 */
	TODO(26000, "提示消息"),
	/**
	 * 已关注
	 */
	HAS_CONCERNED(26002, "已关注"),
	/**
	 * 打卡不存在
	 */
	WEBLOG_UNEXIST(26003, "打卡不存在"),
	/**
	 * 已投诉，请不要重复投诉
	 */
	REPORT_EXIST(26004, "已投诉，请不要重复投诉"),
	
	/**
	 * 不允许关注自己
	 */
	FOLLOW_MYSELF(26005, "不能关注自己"),

	/**
	 * 存在敏感词汇
	 */
	PRESENCE_SENSITIVE_VOCABULARY(26006, "存在敏感词汇"),
	

	WX_CHECK(26007, "%s");

	private final Integer code;

	private final String message;

	private FriendCode(Integer code, String message) {
		this.code = code;
		this.message = message;
	}

	public Integer getCode() {
		return code;
	}

	public String getMessage() {
		return message;
	}

	/**
	 * 把code转化为ResponseCode枚举
	 * 
	 * @param code
	 *            代码
	 * @return
	 */
	public static FriendCode from(Integer code) {
		if (code == null) {
			return null;
		}
		return CODE_MAP.get(code);
	}

	/**
	 * Code Map for ResponseCode
	 */
	private static final Map<Integer, FriendCode> CODE_MAP = Stream.of(FriendCode.values())
			.collect(Collectors.toMap(FriendCode::getCode, e -> e));

}
